package com.itheima.demo02interface;

import java.util.function.Consumer;

public class Demo04ConsumerAndThen {
    public static void main(String[] args) {
        printHello((String str) ->{
            System.out.println(str.toUpperCase());
        }, (String str) -> {
            System.out.println(str.toLowerCase());
        });
    }

    public static void printHello(Consumer<String> c1, Consumer<String> c2){
        String str = "Hello World";
//        c1.accept(str);
//        c2.accept(str);

        // 效果同上
        c1.andThen(c2).accept(str);
    }
}
